<?php

#基础函数
include_once('_path.php');
include_once("../includes/init.php");

$vote_ids = $_REQUEST['vote_ids'];

#如果vote_ids是
if(!is_array($vote_ids)){
	$vote_ids = array();
	$vote_ids[0] = $_REQUEST['vote_id'];
}

	if(sizeof($vote_ids)){
		foreach ($vote_ids as $vote_id) {
			//$quote['vote_id'] = $database->quote($vote_id);
			if(is_numeric($vote_id)){
				$rs = $database->queryFirst("SELECT id, user_id, images FROM vote WHERE id = ".$vote_id.";");
				$database->execute("DELETE FROM vote WHERE id = ".$vote_id.";");
				//删除物理文件
				@unlink(_CONST_PIC_PATH.'vote/'.$rs['user_id']."/1_".$rs['images']);
				@unlink(_CONST_PIC_PATH.'vote/'.$rs['user_id']."/2_".$rs['images']);
				@unlink(_CONST_PIC_PATH.'vote/'.$rs['user_id']."/".$rs['images']);
				add_log('do_delete', 'vote', "vote id is $vote_id");
			}
		}
	}

$_REQUEST['referrer'] = "./";
redirect("Delete");
?>